CC = g++
DEBUG = -g -D_DEBUG
FL = /p/fltk/fltk/bin/fluid
CXXWARNINGS = -Wchar-subscripts -Wcomment -Wformat=2 -Wparentheses -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wwrite-strings -Wconversion -Wsign-compare -Wmissing-noreturn -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -Wpacked -Wredundant-decls -ftrapv -O2 -fbounds-check -Wno-system-headers -Winline
CWARNINGS = $(CXXWARNINGS) -Wimplicit-int -Werror-implicit-function-declaration -Wbad-function-cast -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs
CFLAGS = -W -Wextra -Wall -Werror -pedantic -ansi -pedantic-errors -Wno-long-long -std=gnu99 $(DEBUG) $(CWARNINGS)
CPPFLAGS = -W -Wextra -Wall -Werror -pedantic -ansi -pedantic-errors -Wno-long-long -std=gnu++98 $(DEBUG) $(CXXWARNINGS)
INCLUDES = $(INCLUDES_SFML)
INCLUDES_SFML = -isystem P:/sfml/SFML-1.5/include
INCLUDES_FLTK = `fltk-config --cxxflags`
INCLUDES_QT =  -IP:/Qt/qt/include
LIBS = -LP:/sfml/SFML-1.5/lib/mingw -LP:/sfml/SFML-1.5/extlibs/libs-mingw
LIBS_SFML = -lsfml-window
LIBS_SFML2 = -lsfml-graphics
LIBS_SFML3 = -lsfml-system
LIBS_GL = -lopengl32 -lglu32
LIBS_QT =  -LP:/Qt/qt/lib -lQtCore4 -lQtGui4
LIBS_FLTK = `fltk-config --ldstaticflags`
LIBS_NET = -lws2_32

all: sebbu_game.exe test_network.exe

clean:
	@-rm *.o

cleanbin:
	@-rm graphics-shape.exe graphics-views.exe window-opengl.exe graphics-qt.exe
	@-rm sebbu_game.exe

distclean: clean cleanbin

sebbu_game.exe: globals.o Titleset.o Map.o Perso.o sebbu_game.o
	$(CC) -mwindows -Wl,--enable-auto-import -o $@ $^ $(LIBS) -lsfml-graphics -lsfml-window -lsfml-system -lstdc++

test_network.exe: Network.o test_network.o
	$(CC) -Wl,--enable-auto-import -o $@ $^ $(LIBS_NET)

%.exe: %.o
	$(CC) -o $@ $^ $(LIBS)

%.cxx: %.fl
	$(FL) -c $^

%.o: %.cpp
	$(CC) $(CPPFLAGS) $(INCLUDES) -o $@ -c $^

%.o: %.cxx
	$(CC) $(CPPFLAGS) $(INCLUDES) -o $@ -c $^

%.o: %.cc
	$(CC) $(CPPFLAGS) $(INCLUDES) -o $@ -c $^

%.o: %.c
	gcc $(CFLAGS) $(INCLUDES) -o $@ -c $^

.PHONY: clean mrproper

mrproper : clean distclean
